//
//  ZSY_SearchCollectionViewCell.m
//  ZSY_BreadTrip
//
//  Created by 张诗宇 on 16/1/6.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "ZSY_SearchCollectionViewCell.h"

@interface ZSY_SearchCollectionViewCell ()

@property (nonatomic, retain) ZSY_BaseLabel *nameLabel;


@end

@implementation ZSY_SearchCollectionViewCell


- (void)dealloc {
    [_nameLabel release];
    [super dealloc];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)setSearch:(ZSY_SearchModel *)search {
    if (_search != search) {
        [_search release];
        _search = [search retain];
        
        self.nameLabel.text = [NSString stringWithFormat:@"   %@   ", _search.name];
        self.nameLabel.layer.cornerRadius = 10;
        self.nameLabel.layer.masksToBounds = YES;
        self.nameLabel.layer.borderWidth = 1;
        self.nameLabel.layer.borderColor = [UIColor lightGrayColor].CGColor;
        [self.nameLabel sizeToFit];
        self.nameLabel.frame = CGRectMake((WIDTH / 2 - self.nameLabel.frame.size.width) / 2, 0, self.nameLabel.frame.size.width, _nameLabel.frame.size.height);
        
        
        
    }
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews {
    self.nameLabel = [[ZSY_BaseLabel alloc] init];
    _nameLabel.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:243 / 255.0 blue:233 / 255.0 alpha:1];
    _nameLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:_nameLabel];
    
    [_nameLabel release];
    
}

@end
